<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Dotnet2-web 后台管理系统</title>
<!--[if lt IE 9]>
<script src="js/html5.js"></script>
<![endif]-->
<%@ include file="/jsp/common/commonJs.jsp"%>
</head>
<body>
<!--header-->
<%@ include file="/jsp/top.jsp"%>
<!--header-->

<!--aside nav-->
<%@ include file="/jsp/left.jsp"%>
<!--aside nav  -->
<section class="rt_wrap content mCustomScrollbar" style="margin-top:10px;">
      <div class="page_title">
       	<a class="fr top_rt_btn" href="${path}/city/toAdd.do">添加城市</a>
      </div>
      <table class="table">
       <tr>
	        <th>城市名称</th>
	        <th>是否删除</th>
	        <th>操作</th>
       </tr>
       	<c:forEach items="${cityList}" var="city">
      		<tr align="center">
		        <td>${city.cityName}</td>
		        <td>
		        	<c:if test="${city.isDelete==0}">
			        	<font color=green>否</font>
		        	</c:if>
		        	<c:if test="${city.isDelete==1}">
		        		<font color=red>是</font>
		        	</c:if>
		        </td>
		        <td>
		        	<c:if test="${city.isDelete==0}">
			        	<a href="javascript:del('${city.id}','1')">删除</a>
		        	</c:if>
		        	<c:if test="${city.isDelete==1}">
		        		<a href="javascript:del('${city.id}','0')">恢复</a>
		        	</c:if>
		        	<a href="${path}/city/toUpdate.do?id=${city.id}">修改</a>
		        </td>
		    </tr>
      	</c:forEach>
      </table>
</section>

</body>
<script>
function del(id,type) {
	$.ajax({
		url : "${path}/city/delete.do",
		type : "post",
		dataType : "json",
		data:{id:id,type:type},
		success : function(data) {
			if (data.status) {
				alert(data.msg);
				window.location.href = "${path}/city/cityList.do";
			} else {
				alert(data.msg);
			}
		}
    });
}
</script>
</html>
